package main

import (
	"flag"
	"gitee.com/dh114007/wechat_token/application"
	"gitee.com/dh114007/wechat_token/config"
	"gitee.com/dh114007/wechat_token/core/middleware"
	"gitee.com/dh114007/wechat_token/driver"
	"log"
)

var fileConfig string

func init() {
	flag.StringVar(&fileConfig, "c", "./app.yml", "配置文件")
	flag.Parse()
}

func main() {
	log.SetFlags(log.LstdFlags | log.Lshortfile)
	cfg := config.NewConfigWithYaml(fileConfig)
	driver.LoggerInit(cfg.Logger)
	driver.GeneratorInit(cfg.Base.Node)
	middleware.Keys = cfg.Auth.Keys

	app := application.NewApp()
	app.Initialize()
	app.Run(cfg.Base.Bind)
}
